package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.Count;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Description:
 * @Author: luog
 * @Date: 2024/12/2
 */
@Mapper
public interface CountMapper extends BaseMapper<Count> {
    /**
     * @Description: 查询总数
     * @Param: []
     * @return: java.lang.Integer
     * @Author: luog
     * @Date: 2024/12/3
     */
    @Select("SELECT sum(count) as count FROM count ")
    public Integer sumCount();

    /**
     * @Description: 增加计数
     * @Param: [id]
     * @return: int
     * @Author: luog
     * @Date: 2024/12/3
     */
    @Update("UPDATE count SET  count=count+ 1, last_login_time=now()  WHERE id=#{id}")
    public int increaceCount(Long id);


}
